#include "unixhead.h"

#include <workflow/WFFacilities.h>
#include <workflow/WFTaskFactory.h>

#include <iostream>
using namespace std;
//using namespace ;

static WFFacilities::WaitGroup waitGroup(1);

void sighandler(int signum)
{
    cout << "wait group done\n";
    waitGroup.done();//每执行一次done，任务会减少1个，减为0时，wait就会返回
}

int main()
{
    signal(SIGINT, sighandler);

    //创建了一个HTTP任务对象
    auto httpTask = WFTaskFactory::create_http_task("http://www.baidu.com", 0, 0, nullptr);
    //将任务交给框架去运行
    httpTask->start();

    waitGroup.wait();//阻塞当前进程

    return 0;
}